package net

import (
	"fmt"
	"github.com/gocolly/colly/v2"
)

// 爬虫第三方高级库
func CollyDemo() {
	c := colly.NewCollector()

	c.OnHTML("a[href]", func(e *colly.HTMLElement) {
		//link := e.Attr("href")
		//fmt.Println(link)
		fmt.Println(e.Text)
	})

	err := c.Visit("https://yz.chsi.com.cn/sch/schoolInfo--schId-367878.dhtml")
	if err != nil {
		fmt.Println("Error:", err)
	}
}
